<?php
/* 
 *代售待发货to shipping orders--retail
 */
class AgentToShippingAction extends ToShippingAction {
    public function _filter(&$map) {
        parent::_filter($map);
        $map['warehouse_id'] = $_SESSION['warehouse_id'];
    }

    public function pick_goods($tpl="ToShipping:pick_goods"){
        parent::pick_goods($tpl);
    }

    public function invoice($tpl="ToShipping:invoice"){
        parent::invoice($tpl);
    }

    public function doshipping($tpl="ToShipping:doshipping"){
        parent::doshipping($tpl);
    }

    public function edit(){
        if($_SESSION['warehouse_id'] != $ware_id = M('Sale')->where('id='.$_REQUEST['id'])->getField('warehouse_id') )
            $this->error("对不起,该订单不属于贵公司!");
        parent::edit();
    }

    public function update(){
        if($_SESSION['warehouse_id'] != $ware_id = M('Sale')->where('id='.$_REQUEST['id'])->getField('warehouse_id') )
            $this->error("对不起,该订单不属于贵公司!");
        parent::update();
    }

    //导入快递单
    public function import_order_express($tpl="Prepare:import_order_express"){
         A('Prepare')->import_order_express($tpl);
    }

    //自动发货
    public function auto_doshipping(){
         A('Prepare')->auto_doshipping();
    }

}
?>
